package org.lmj.dos.common.bean;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class Response<T> {
    private Integer status;
    private String msg;
    private T data;

    public static <T> Response<T> success(T data) {
        return success(0,data);
    }

    public static <T> Response<T> success(int status, T data) {
        Response<T> response = new Response<T>();
        response.setStatus(0);
        response.setData(data);
        //log.info("请求返回报文为：{}", response.toString());
        return response;
    }

    public static <T> Response<T> success(int status,String msg, T data) {
        Response<T> response = new Response<T>();
        response.setStatus(0);
        response.setData(data);
        response.setMsg(msg);
        //log.info("请求返回报文为：{}", response.toString());
        return response;
    }
}
